package com.study.springboot.SpringBoot_A.mq.rabbitmq;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author 赵超
 * @Description Fanout Exchange发送者
 * @create 2018-03-29 13:34
 **/
@Component
public class FanoutSender {

    @Autowired
    private AmqpTemplate amqpTemplate;

    public void send() {
        String con = "Hi, fanout !";
        System.out.println("send: " + con);
        // 发送端的routing_key写任何字符都会被忽略
        amqpTemplate.convertAndSend("fanoutExchange", "", con);
    }

}
